home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / sys5 / iscwmpst.z / iscwmpst / tcp / misc / daily < prev    next >
Encoding:
Text File  |  1991-10-29  |  2.8 KB  |  103 lines

  1. #! /bin/csh
  2.  
  3. # daily: daily system maintenance
  4.  
  5. set path = ( /bin /usr/bin /usr/lib /usr/contrib/bin /usr/local/bin /etc /usr/local/etc)
  6. set nonomatch
  7. set tmp = /tmp/daily.$$
  8. umask 022
  9. unset noclobber
  10.  
  11. ##### fix mode and ownership of device files #####
  12.  
  13. # chmod 600  /dev/tnc*
  14. # chmod 666            /dev/tty* /dev/pty/* /dev/ptym/*
  15. # chown root /dev/tnc* /dev/tty* /dev/pty/* /dev/ptym/*
  16. # chgrp root /dev/tnc* /dev/tty* /dev/pty/* /dev/ptym/*
  17.  
  18. ##### remove garbage files #####
  19.  
  20. touch /usr/spool/mqueue/syslog
  21.  
  22. find /                 -name core        -exec rm -f {} \; >& /dev/null
  23. find /                 -name dead.letter -exec rm -f {} \; >& /dev/null
  24. find /tmp /usr/tmp     -atime +2         -exec rm -f {} \; >& /dev/null
  25. find /usr/preserve     -atime +6         -exec rm -f {} \; >& /dev/null
  26. ## find /usr/spool/mqueue -mtime +6         -exec rm -f {} \; >& /dev/null
  27.  
  28. ##### remove/truncate system logfiles #####
  29.  
  30. # rm -f                         /usr/lib/cron/OLDlog
  31. # rm -f                         /usr/spool/lp/oldlog
  32. trunc -b  0 -c 644 -m root /usr/adm/sulog
  33. # trunc -b  5000 -c 644         /etc/backuplog
  34. trunc -b  5000 -c 644         /usr/adm/messages
  35. # trunc -b  1000 -c 644         /usr/spool/smail/log/logfile
  36. trunc -b  1000 -c 644         /usr/lib/news/nntplog
  37. # trunc -b  5000 -c 644         /usr/spool/lp/log*
  38. trunc -b 50000 -c 644         /usr/spool/mqueue/syslog
  39. trunc -b 0        -m root /usr/adm/OLDsulog
  40.  
  41. ##### cleanup users #####
  42.  
  43. # udbm
  44. # rmoldusers > /dev/null
  45.  
  46. ##### cleanup net system #####
  47.  
  48. trunc -b 20000 -c 644 /tcp/net.log
  49.  
  50. find /tcp/logs      -mtime +6 -exec rm -f {} \; >& /dev/null
  51.  
  52. cd /tcp/util
  53. # tar -tvfx util.tar
  54. cp /users/src/convers/conversd /tcp/conversd
  55. chmod og-rwx /tcp/conversd /tcp/util
  56. ##### Make /tcp backup     #####
  57.  
  58. cd /tcp
  59. mv /users/src/tcpbak.tar.Z /users/src/otcpbak.tar.Z
  60. tar -cvf /users/src/tcpbak.tar Makefile hosts convers* *.conf *.rc net* *data users src >/dev/null
  61. compress /users/src/tcpbak.tar
  62. ls -l /users/src/tcpbak.tar.Z
  63. cd /users/src
  64. doserase b:tcpbak.taz
  65. dosput tcpbak.tar.Z b:tcpbak.taz
  66.  
  67. ##### update lan databases #####
  68.  
  69. rm -rf /usr/spool/rwho/*
  70.  
  71. ##### update mail databases #####
  72.  
  73. ##### do an archive backup #####
  74.  
  75. # cd /
  76. # touch /etc/archivedate
  77. # ( echo "s `date` `uname -r` archive" ; \
  78. #   find * -print | grep -v '^titus/' | cpio -oacx | compress | tcio -ov /dev/rct/c0 ; \
  79. #   tcio -urV /dev/rct/c0 ; \
  80. #   echo "f `date`" ; \
  81. #   echo '-----' \
  82. # ) >>& /etc/backuplog
  83.  
  84. ##### the following is done only once in a week #####
  85.  
  86. # if (`date +%w` == 6) then
  87.  
  88. ##### inform users about old files #####
  89.  
  90. # cd /users/funk
  91. # foreach user (*)
  92.   # find /users/funk/$user -atime +100 -print >$tmp
  93.   # if ( ! -z $tmp ) then
  94.     # echo '\nThese files were not accessed in the last 30 days.' >>$tmp
  95. ##  mailx -s 'Unused files' $user <$tmp
  96. # mailx -s 'Unused files' olaf <$tmp
  97.   # endif
  98. # end
  99. # rm -f $tmp
  100.  
  101. # endif
  102. #
  103.